package com.hsc.yalebao.tools;

import android.annotation.SuppressLint;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

@SuppressLint({"SimpleDateFormat"})
public class DateUtil
{
  public static String dateToString(Date paramDate, String paramString)
  {
    return new SimpleDateFormat(paramString).format(paramDate);
  }

  public static int getCurrentTime(Date paramDate)
  {
    int i = paramDate.getHours();
    int j = paramDate.getMinutes();
    if ((i >= 5) && (i <= 7))
    {
      if (((i != 5) && (i != 7)) || (j < 30))
        return 0;
      return 1;
    }
    if ((i >= 8) && (i <= 11))
    {
      if ((i == 8) || (i == 11))
      {
        if (j < 30)
          return 1;
        return 2;
      }
      return 1;
    }
    if ((i >= 13) && (i <= 17))
    {
      if ((i == 13) || (i == 17))
      {
        if (j < 30)
          return 2;
        return 3;
      }
      return 2;
    }
    if ((i > 18) && (i <= 21))
    {
      if ((i == 18) || (i == 21))
      {
        if (j < 30)
          return 3;
        return 4;
      }
      return 3;
    }
    return 4;
  }

  public static Date getDateAfter(Date paramDate, int paramInt)
  {
    Calendar localCalendar = Calendar.getInstance();
    localCalendar.setTime(paramDate);
    localCalendar.set(5, paramInt + localCalendar.get(5));
    return localCalendar.getTime();
  }

  public static Date getDateBefore(Date paramDate, int paramInt)
  {
    Calendar localCalendar = Calendar.getInstance();
    localCalendar.setTime(paramDate);
    localCalendar.set(5, localCalendar.get(5) - paramInt);
    return localCalendar.getTime();
  }

  public static Date getDateByInt(int paramInt)
  {
    Date localDate = new Date();
    localDate.setTime(1000L * paramInt);
    return localDate;
  }

  public static Date getDateFromTimeString(String paramString1, String paramString2)
  {
    Date localDate1 = new Date();
    SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat(paramString2);
    try
    {
      Date localDate2 = localSimpleDateFormat.parse(paramString1);
      return localDate2;
    }
    catch (ParseException localParseException)
    {
    }
    return localDate1;
  }

  public static int getDay(Date paramDate)
  {
    Calendar localCalendar = Calendar.getInstance();
    localCalendar.setTime(paramDate);
    return localCalendar.get(5);
  }

  public static int getDayCount()
  {
    Calendar localCalendar = Calendar.getInstance();
    localCalendar.set(5, 1);
    localCalendar.roll(5, -1);
    return localCalendar.get(5);
  }

  public static int getHour(Date paramDate)
  {
    Calendar localCalendar = Calendar.getInstance();
    localCalendar.setTime(paramDate);
    return localCalendar.get(11);
  }

  public static int getIntFromString(String paramString)
  {
    String[] arrayOfString = paramString.split(":");
    int i = arrayOfString.length;
    int j = 0;
    if (i == 3)
    {
      int k = Integer.parseInt(arrayOfString[0]);
      int m = Integer.parseInt(arrayOfString[1]);
      int n = Integer.parseInt(arrayOfString[2]);
      int i1 = 1000 * (60 * (k * 60));
      int i2 = 1000 * (m * 60);
      j = n * 1000 + (i1 + i2);
    }
    return j;
  }

  public static long getMillis(Date paramDate)
  {
    Calendar localCalendar = Calendar.getInstance();
    localCalendar.setTime(paramDate);
    return localCalendar.getTimeInMillis();
  }

  public static int getMinute(Date paramDate)
  {
    Calendar localCalendar = Calendar.getInstance();
    localCalendar.setTime(paramDate);
    return localCalendar.get(12);
  }

  public static int getMonth(Date paramDate)
  {
    Calendar localCalendar = Calendar.getInstance();
    localCalendar.setTime(paramDate);
    return 1 + localCalendar.get(2);
  }

  public static int getNowTime()
  {
    return (int)(new Date().getTime() / 1000L);
  }

  public static int getSecond(Date paramDate)
  {
    Calendar localCalendar = Calendar.getInstance();
    localCalendar.setTime(paramDate);
    return localCalendar.get(13);
  }

  public static String getSection(int paramInt1, int paramInt2)
  {
    String str1 = "开始";
    if (paramInt1 != 0)
      str1 = intToString(paramInt1, "HH:mm:ss");
    String str2 = "结束";
    if (paramInt2 != 0)
      str2 = intToString(paramInt2, "HH:mm:ss");
    return str1 + "~" + str2;
  }

  public static String getStringSimplefromInt(int paramInt)
  {
    if (paramInt == 0)
      return "00分00秒";
    int i = paramInt / 1000;
    int j = i / 60;
    int k = i % 60;
    String str1;
    if (k < 10)
    {
      str1 = "0" + k;
      if (j >= 10)
        break label121;
    }
    label121: for (String str2 = "0" + j; ; str2 = j)
    {
      return str2 + "分" + str1 + "秒";
      str1 = k;
      break;
    }
  }

  public static String getStringfromInt(int paramInt)
  {
    if (paramInt == 0)
      return "00分00秒";
    int i = paramInt / 60;
    int j = paramInt % 60;
    String str1;
    if (j < 10)
    {
      str1 = "0" + j;
      if (i >= 10)
        break label112;
    }
    label112: for (String str2 = "0" + i; ; str2 = i)
    {
      return str2 + "分" + str1 + "秒";
      str1 = j;
      break;
    }
  }

  public static int getTime(String paramString1, String paramString2)
  {
    SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat(paramString2);
    try
    {
      long l = localSimpleDateFormat.parse(paramString1).getTime() / 1000L;
      return (int)l;
    }
    catch (ParseException localParseException)
    {
      localParseException.printStackTrace();
    }
    return 0;
  }

  public static String getTimeStrFromLong(long paramLong, String paramString)
  {
    Date localDate = new Date(paramLong);
    return new SimpleDateFormat(paramString).format(localDate);
  }

  public static int getYear(Date paramDate)
  {
    Calendar localCalendar = Calendar.getInstance();
    localCalendar.setTime(paramDate);
    return localCalendar.get(1);
  }

  public static String intToString(int paramInt, String paramString)
  {
    Date localDate = new Date(1000L * paramInt);
    return new SimpleDateFormat(paramString).format(localDate);
  }

  public static boolean isInDate(Date paramDate1, Date paramDate2, Date paramDate3)
  {
    return (paramDate1.getTime() >= paramDate2.getTime()) && (paramDate1.getTime() < paramDate3.getTime());
  }

  public static String longToString(long paramLong, String paramString)
  {
    Date localDate = new Date(paramLong);
    return new SimpleDateFormat(paramString).format(localDate);
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tools.DateUtil
 * JD-Core Version:    0.6.2
 */